#include <iostream>
#include <vector>
using namespace std;

void merge(int A[], int m, int B[], int n) 
{
  std::vector<int> vA;
  int ia=0;
  int ib=0;
  while(ia+ib<m+n)
  {
    
    if ( m>0 &&ia!=m &&( (A[ia] < B[ib]) || ib==n ) )
    {
      vA.push_back(A[ia]);
      ia++;
    }
    else if ( n>0 && ib!=n && ( (A[ia] >= B[ib]) || ia==m ) )
    {
      vA.push_back(B[ib]);
      ib++;
    }
  }

  for(int i=0;i<m+n;++i)
  {
      A[i] = vA[i];
      cout<<A[i]<<",";
  }




}

int main(int argc,char *argv[])
{
    int A[]={1,1,2,3};
    int m=4;
    int B[]={};
    int n=0;
    merge(A,m, B, n); 

}
